home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol C-14
/
Vol C-14.iso
/
games
/
smashing.swf
/
scripts
/
frame_5
/
DoAction.as
Wrap
Text File
|
2012-04-23
|
6KB
|
204 lines
function makePositive(numberToConvert, boolean)
{
if(boolean)
{
if(0 >= numberToConvert)
{
numberToConvert = - numberToConvert;
}
}
else if(numberToConvert >= 0)
{
numberToConvert = - numberToConvert;
}
return numberToConvert;
}
function addPoints(targetMc, points)
{
if(0 < points)
{
totalScore += points;
menu.txtScore = totalScore;
}
if(totalScore >= nextExtraLife)
{
sndGrabBonus.start();
nextExtraLife += extraLifeEveryNPoints;
padsLeft++;
menu.txtPadsLeft = padsLeft;
points = "EXTRA PAD";
}
strPoints = new String(points);
clipCounter++;
attachMovie("mcShowPoints","mcShowPoints" + clipCounter,clipCounter);
this["mcShowPoints" + clipCounter].txtPoints1 = points;
this["mcShowPoints" + clipCounter].txtPoints2 = points;
this["mcShowPoints" + clipCounter]._x = int(targetMc._x - strPoints.length * 7 / 2);
this["mcShowPoints" + clipCounter]._y = int(targetMc._y);
this["mcShowPoints" + clipCounter].play();
}
function keyInput()
{
if(Key.isDown(80) && keyPressValid && gameInProgress)
{
keyPressValid = false;
if(!gamePaused && keyPressPause < getTimer())
{
pauseStatus = showStatus("paused",10000);
gamePaused = true;
mcPause.gotoAndPlay("paused");
keyPressPause = getTimer() + 100;
}
else if(keyPressPause < getTimer())
{
pauseStatus.play();
gamePaused = false;
mcPause.gotoAndStop(1);
keyPressPause = getTimer() + 100;
}
}
else if(Key.isDown(83) && keyPressValid && !typingPassword)
{
keyPressValid = false;
if(!soundOn && keyPressPause < getTimer())
{
globalSound.setVolume(100);
showStatus("sound on",500);
soundOn = true;
keyPressPause = getTimer() + 100;
}
else if(keyPressPause < getTimer())
{
globalSound.setVolume(0);
showStatus("sound off",500);
soundOn = false;
mcSound.gotoAndPlay("toggleSound");
keyPressPause = getTimer() + 100;
}
}
else if(!Key.isDown(83) && !Key.isDown(80))
{
keyPressValid = true;
}
}
function showStatus(message, delay)
{
clipCounter++;
attachMovie("mcStatus","mcStatus" + clipCounter,clipCounter);
this["mcStatus" + clipCounter]._x = 320;
this["mcStatus" + clipCounter]._y = 240;
this["mcStatus" + clipCounter].txtStatus = message;
this["mcStatus" + clipCounter].delay = delay;
statusMcPath = eval(this["mcStatus" + _root.clipCounter]);
return statusMcPath;
}
function initiateNewLevel()
{
totalBricks = brickNumber;
totalBricks -= indestructibleAmount;
bricksLeft = totalBricks - smashedBricks;
randomBonusFactor = int(100 / bricksLeft * arrBonuses.length);
menu.txtBricksLeft = bricksLeft;
menu.txtLevel = currentLevel;
menu.txtPadsLeft = padsLeft;
showStatus("level " + currentLevel,1000);
gamePaused = false;
sndPadAppear.start();
}
function cleanClips()
{
i = 1;
while(clipCounter >= i)
{
mcTarget2 = eval("mcBonusFalling" + i);
mcTarget3 = eval("mcBall" + i);
mcTarget2.removeMovieClip();
mcTarget3.removeMovieClip();
i++;
}
clipCounter = 0;
}
function resetGame()
{
bricksLeft = 0;
brickNumber = 0;
ballsActive = 0;
smashedBricks = 0;
indestructibleAmount = 0;
totalBricks = 0;
clipCounter = 0;
totalScore = 0;
menu.txtBricksLeft = 0;
menu.txtLevel = 0;
menu.txtPadsLeft = 0;
menu.txtScore = 0;
}
function resetLevel()
{
cleanClips();
readyToShootBall = false;
bricksLeft = 0;
brickNumber = 0;
ballsActive = 0;
smashedBricks = 0;
indestructibleAmount = 0;
totalBricks = 0;
clipCounter = 0;
}
arrLevelCode = new Array();
arrLevelCode[0] = "MINICLIP";
arrLevelCode[1] = "BREAKOUT";
arrLevelCode[2] = "FLAMES";
arrLevelCode[3] = "JEWELS";
arrLevelCode[4] = "ZED";
arrLevelCode[5] = "OOP OOP";
arrLevelCode[6] = "KEFRENS";
arrLevelCode[7] = "MB";
arrLevelCode[8] = "FRAME";
arrLevelCode[9] = "BOOM";
arrLevelCode[10] = "INVADE";
arrLevelCode[11] = "WW";
arrLevelCode[12] = "RAF";
arrLevelCode[13] = "WINGS";
arrLevelCode[14] = "CASTLE";
arrLevelCode[15] = "TUBE";
arrLevelCode[16] = "MAGIC";
arrLevelCode[17] = "FENCE";
arrLevelCode[18] = "LIFT";
arrLevelCode[19] = "UFO";
arrLevelCode[20] = "POMPEII";
arrLevelCode[21] = "MAYPOLE";
arrLevelCode[22] = "ROB";
arrLevelCode[23] = "FING";
arrLevelCode[24] = "CLUSTER";
arrLevelCode[25] = "BRICKS";
arrLevelCode[26] = "MAGNETS";
arrLevelCode[27] = "FLOPPY";
arrLevelCode[28] = "BROLLY";
arrLevelCode[29] = "TENNIS";
arrLevelCode[30] = "ZEN";
arrLevelCode[31] = "SVERIGE";
arrLevelCode[32] = "FENG SHUI";
arrLevelCode[33] = "BOMB";
arrLevelCode[34] = "ZED HOUSE";
arrLevelCode[35] = "CAGE";
arrLevelCode[36] = "IGLOO";
arrLevelCode[37] = "REACTION";
arrLevelCode[38] = "LURVE";
arrLevelCode[39] = "BIRA";
arrLevelCode[40] = "NANA";
arrLevelCode[41] = "SAVAGE";
arrLevelCode[42] = "ENGERLUND";
arrLevelCode[43] = "TOTEBO";
arrLevelCode[44] = "PONG";
arrLevelCode[45] = "BORE";
arrLevelCode[46] = "CATCH";
arrLevelCode[47] = "GEEGEE";
arrLevelCode[48] = "COPPERTOP";
arrLevelCode[49] = "FULL-TIME";
arrLevelCode[50] = "ROBSTER";
soundOn = true;
extraLifeEveryNPoints = 20000;
nextExtraLife = extraLifeEveryNPoints;
scoreTimer = getTimer();